<form action="{{url:site uri='business/update'}}/{{project:id}}" method="post" class="form_input" >
	<!--<input type="hidden" value="{{project:id}}" name="id"  id="id" />-->
	<input type="hidden" value="{{project:percent}}" name="percent"  id="percent" />
	<input type="hidden" value="{{user:id}}" name="user_id" />
	<input type="hidden" value="{{list_user}}" name="list_user" />
	<button name="btnAction" value="save" style="display:none;">Save</button>
</form>
<div class="con">
<h3>{{ helper:lang line = 'project:percent' }}: <span class="percent">{{project:percent}}</span> %</h3>
</div>

<div class="con">
<div class="slider view" per="{{project:percent}}"></div>
<div class="time">
<label class="fl">{{helper:date format = 'd-m-Y' timestamp = project:date_start}}</label>
<label class="fr">{{helper:date format = 'd-m-Y' timestamp = project:date_end}}</label>
</div>
</div>
<div class="fl" style="width:40%;overflow: hidden;">
<div class="con">
<h3>{{ helper:lang line = 'project:user_receive' }}</h3>
<ul class="style">
{{project_users}}
	<li class="im-{{important}}">{{text:toupper value = display_name}}</li>
{{/project_users}}
</ul>
</div>
<div class="con">
<h3>{{ helper:lang line = 'project:comment' }}</h3>
<ul class="list-comment">
<?php foreach ($comments as $item){ 
$cl = "";
if (!empty($item->file)) 
	$cl = "hasfile";
?>
<li class="item-comment <?php echo $cl?>">
<strong class="fl"><?php echo $item->display_name ?></strong> 
<?php if (!empty($item->file)) { ?>
	<a title="{{ helper:lang line = 'project:file_att' }}" target="_blank" class="attach-icon fl" href="{{url:site uri = '<?php echo 'uploads/files/'.$item->username.'/'.$item->file ?>'}}" >
		{{ helper:lang line = 'project:file_att' }}
	</a>
<?php } ?>
<small {{ if {helper:date format='d-m-Y' timestamp = '<?php echo $item->created;?>'} == '<?php echo date("d-m-Y");?>' }} style="color:#F00" {{endif}}>{{helper:date format='d-m-Y H:i' timestamp = '<?php echo $item->created;?>'}} </small> 
<p class="clr"><?php echo nl2br($item->content) ?></p>

</li>
<?php } ?>
</ul>
<a class="readmore cl bg-user" title="{{ helper:lang line = 'comment:readmore' }}">{{ helper:lang line = 'comment:readmore' }}</a>
<form id="comment" method="post" action="{{url:site uri='business/comment'}}" enctype="multipart/form-data" >
	<input type="hidden" value="{{project:id}}" name="project_id" />
	<input type="hidden" value="{{user:id}}" name="user_id" />
	<input type="hidden" value="{{list_user}}" name="list_user" />
	<input type="hidden" value="" name="file" id="file_append" />
	
	<div class="errors">  </div>
	
	<div style="" class="input"><textarea class="editor" name="content" style="width:97%;resize:none;" rows="6" ></textarea></div>
	
	<div><p class="file_name fl"></p></div>
	
	
	
	<div class="clr">
		<button class="btn bg-user">{{ helper:lang line = 'project:send' }}</button>
	</div>
</form>
<form id="frm_upload_file" method="post" action="{{url:site uri='business/upload'}}" enctype="multipart/form-data" >

<div style="display:none">File: <input type="file" class="upload_file" name="upload" /></div>
<a class="file_att btn bg-user fl" href="javascript:void(0)" >{{ helper:lang line = 'project:file_att' }}</a>
</form>
<script type="text/javascript">

var comment;
$('#comment .btn').click(function(){
	if(comment!=null)
		comment.abort();
	comment = $.ajax({
		url:$('#comment').attr('action'),
		data:$('#comment').serialize(),
		type:'post',
		dataType:'json',
		success: function(data){
			if(data.error){
				$('div.errors').addClass('alert').html('').append(data.error);
			}
			else{
				$('form#comment textarea').val('');
				location.reload();
			}
		}
	});
	return false;
});
addClass_slider($('.slider'),'{{project:percent}}');									
								
</script>
</div>
</div>
<div class="fr" style="width:55%;border-left:1px solid #ccc;padding-left:10px">
<div class="con">
<h3>{{ helper:lang line = 'project:description' }}</h3>
{{project:description}}
</div>
</div>

<div class="line"></div>
<!--CONG VIEC LIEN QUAN-->
<!--truong phong-->
{{if user:group_id == 3 OR user:group_id == 2}}  <!--truong phong | giam doc-->

{{if project_childs:projects }}
<div class="con" style="clear:both"><h3>{{ helper:lang line = 'project:childs' }}</h3></div>
<table class="kunTable">
<thead>
    	<th width="20">{{ helper:lang line="global:identifier" }}</th>
        <th width="10"><input type="checkbox" class="checkAll" /></th>
        <th>{{ helper:lang line="project:title" }}</th>
		<th width="160">{{ helper:lang line="project:user_receive" }}</th>
		
        <th width="100">{{ helper:lang line="project:date_start" }}</th>
		<th width="100">{{ helper:lang line="project:date_end" }}</th>
		<th width="130">{{ helper:lang line="project:percent" }}</th>
		<th width="30"></th>
		{{if user:group_id == 3 }}
		<th style="min-width:1px;max-width:50px"></th>
		{{endif}}
    </thead>
    <tbody>
	{{project_childs:projects}}
		<tr>
            <td>
               	{{ helper:count identifier }}
            </td>
            <td><input type="checkbox" class="checkGroup" value="{{id}}" /></td>
            <td><a href="{{url:site uri='business/view/{{id}}'}}" class="bg-user">{{title}}</a></td>
			<td class="cpt">{{display_name}}</td>
            <td>{{ helper:date format='d-m-Y' timestamp = date_start }}</td>
			<td>{{ helper:date format='d-m-Y' timestamp = date_end }}</td>
			<td><div class="slider" per="{{percent}}"></div></td>
			<td><small>{{percent}} %</small></td>
			{{if user:group_id == 3 }}
			<td>
				{{button:href: class="edit" title={helper:lang line="global:edit"} data-toggle="tooltip" 
                   		href={url:site uri="business/edit/{{id}}"} }}
                   {{button:href: class="del" title={ helper:lang line="global:delete"} data-toggle="tooltip" 
                   		href={url:site uri="business/delete/{{id}}"} }}
			</td>
			{{endif}}
        </tr>
	{{/project_childs:projects}}
	</tbody>
</table>
{{endif}}
{{if user:group_id == 3 }}
<form action="{{url:site uri='business/addchild'}}" method="post" class="form_input" >
<input type="hidden" value="{{project:id}}" name="project_id" />
<button>{{helper:lang line = 'project:addchild'}}</button>
</form>
{{endif}}
<!--<button>{{helper:lang line = 'project:helper_room'}}</button>-->

{{endif}}
<!--END : CONG VIEC LIEN QUAN-->




<script type="text/javascript">
var t;
for_slider();
$sliders = $('.slider.view');
{{if role}} // duoc quyen update (nguoi chiu trach nhiem chinh || truong phong)
$('.slider.view').slider({
	value:{{project:percent}},
	step:5,
	min:0,
	max:100,
	range: "min",
	slide:function(event,obj){
		//t=obj;
		$('span.percent').text(obj.value);
		$('.form_input #percent').val(obj.value);
		addClass_slider($('.slider.view'),obj.value);
		//$('#percent').text()
	}
});
addClass_slider($sliders,{{project:percent}});
{{else}}
for_slider();
{{endif}}



$('a.file_att').click(function(){
	$('input.upload_file').trigger('click');
});
$(function () {
        $('#frm_upload_file').fileupload({
            dataType: 'json',
			//url:'{{url:site uri="business/upload"}}',
            success: function (data) {
				$('p.file_name').text(data.name);
				$('input#file_append').val(data.name);
				return false;
            }
        });
    });

	
	//chi hien thi 10 tin comment 1 lan 
$num = 8; //so comment hien thi	
$items = $('.item-comment');
$items.hide();

$items.slice(0,$num).fadeIn(600);
$('a.readmore').click(function(){
	$cu = $('.item-comment:hidden');
	if($cu.length> 0 ){
		$cu.slice(0,$num).fadeIn(600);
	}
	else
		$(this).hide();
});

$option = {
	status: true,
	b : true,i: true,u: true,br : true,button: true,center: true,
	fsizes: true,title: true,color: true,link:true,unlink: true,
	//false
	format: false,funit: false,linktypes: false,left: false,	ul: false,ol: false,
	remove: false,right: false,rule: false,source: false,sub: false,strike: false,p: false,
	sup: false,	placeholder: false,indent: false,outdent: false,fsize: false
};
$(".editor").jqte($option);
</script>